package com.linsen.core.cloud.util;

import cn.hutool.core.util.BooleanUtil;
import cn.hutool.system.SystemUtil;

/**
 * @author zhaoyong
 * @date 2023/8/8
 */
public final class BootstrapUtil {
    public final static String ENV_BOOTSTRAP_KEY = "spring.cloud.bootstrap.enabled";

    /**
     * 启用Bootstrap
     */
    public static void enableBootstrap() {
        String value = SystemUtil.get(ENV_BOOTSTRAP_KEY);
        if (Boolean.TRUE.equals(BooleanUtil.toBooleanObject(value))) {
            return;
        }

        SystemUtil.set("spring.cloud.bootstrap.enabled", Boolean.TRUE.toString());
    }
}
